import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/pages/Home'

Vue.use(VueRouter)

export const createRouter = ()=>{
    const router = new VueRouter({
        mode:'history',
        routes:[
            {
                path:'/',
                name:'home',
                component:Home
            },
            {
                path:'/',
                name:'about',
                component:()=>import('@/pages/About')
            },
            {
                path:'/posts',
                name:'posts',
                component:()=>import('@/pages/Posts')
            },
            {
                path:'*',
                name:'error',
                component:()=>import('@/pages/404')
            }
        ]
    })
    return router
}